<template>
  <div class="statistics">
    <div class="statistic-item" v-for="(item, index) in statistics" :key="index">
      <h3>{{ item.title }}</h3>
      <div class="data">
        <span class="value">{{ item.value }}</span>
        <span class="total">总量: {{ item.total }} {{ item.percentage }}日环比</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const statistics = ref([
  {
    title: '新增用户(人)',
    value: 584,
    total: 18900,
    percentage: '13%'
  },
  {
    title: '新增次留(人)',
    value: 151,
    total: 18900,
    percentage: '30%'
  },
  {
    title: '活跃量(人)',
    value: 801281,
    total: 138900,
    percentage: '30%'
  },
  {
    title: '下载量(次)',
    value: 681281,
    total: 118900,
    percentage: '30%'
  }
]);
</script>

<style scoped>
.statistics {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
}

.statistic-item {
  flex: 1;
  min-width: 200px;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 8px;
}

.statistic-item h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
}

.data {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.value {
  font-size: 24px;
  font-weight: bold;
}

.total {
  font-size: 14px;
  color: #666;
}
</style>